asm
  ld sp,$87FF
  end asm

#include "./library/pacmandelay.bas"
#include "./library/smsrnd.bas"

dim eee as uinteger at $8012
dim seed as uinteger at $8014
dim ee0 as uinteger at $8010
dim ee1 as uinteger at $801A
dim ee2 as uinteger at $8016
dim ee3 as uinteger at $8018
dim ex0 as uinteger at $8020
dim ey0 as uinteger at $8022

sub blueprintputchar(txp1 as uinteger,typ1 as uinteger,tch1 as ubyte,tat1 as ubyte):
  poke $9000+typ1*32+txp1,tch1
  poke $F000+typ1*32+txp1,tat1
  end sub

for ee0=0 to 31
  for ee1=0 to 31
    ee2=seed:seed=smsrnd(seed)
    ee2=seed:seed=smsrnd(seed)
    blueprintputchar(ee1,ee0,96+(seed mod 54),peek(@attr01+(ee2 mod 36)))
    next:next
 
for ee0=0 to 15
  for ee1=0 to 15
    blueprintputchar(ee1+13,ee0+15,ee0*16+ee1,$1C)
    next:next


eee=0:ex0=8:ey0=8
do

blueprintputchar(3,1,48+int(eee/10000) mod 10,$0A)
blueprintputchar(4,1,48+int(eee/1000) mod 10,$0A)
blueprintputchar(5,1,48+int(eee/100) mod 10,$0A)
blueprintputchar(6,1,48+int(eee/10) mod 10,$0A)
blueprintputchar(7,1,48+eee mod 10,$0A)

ee0=peek($C000)
blueprintputchar(5,3,48+int(ee0/100) mod 10,$0A)
blueprintputchar(6,3,48+int(ee0/10) mod 10,$0A)
blueprintputchar(7,3,48+ee0 mod 10,$0A)

ex0=ex0-((ee0 band 16)/16)+((ee0 band 32)/32)
ey0=ey0-((ee0 band 64)/64)+((ee0 band 128)/128)

ee0=peek($C001)
blueprintputchar(5,4,48+int(ee0/100) mod 10,$0A)
blueprintputchar(6,4,48+int(ee0/10) mod 10,$0A)
blueprintputchar(7,4,48+ee0 mod 10,$0A)

ee0=peek($C003)
blueprintputchar(5,5,48+int(ee0/100) mod 10,$0A)
blueprintputchar(6,5,48+int(ee0/10) mod 10,$0A)
blueprintputchar(7,5,48+ee0 mod 10,$0A)


blueprintputchar(ex0,ey0,eee mod 152,$0C)

eee=eee+1
loop



do:loop

do

for eee=$000 to $3FF
  seed=smsrnd(seed)
  'poke $9000+eee,seed
  poke $9000+eee,96+(seed mod 54)
  seed=smsrnd(seed)
  'poke $F000+eee,seed
  poke $F000+eee,peek(@attr01+(seed mod 36))
  poke $E000,127
  pacmandelay(1000)
  next

'for eee=$9000 to $93FF
'  seed=smsrnd(seed)
'  'poke eee,seed
'  poke eee,96+(seed mod 27)
'  poke $E000,127
'  pacmandelay(1000)
'  next
'for eee=$F000 to $F3FF
'  seed=smsrnd(seed)
'  poke eee,seed
'  poke $E000,127
'  pacmandelay(1000)
'  next

for eee=$A000 to $A0FF
  seed=smsrnd(seed)
  'poke eee,seed
  poke eee,0
  poke $E000,127
  pacmandelay(1000)
  next

for eee=$B000 to $B0FF
  seed=smsrnd(seed)
  poke eee,seed
  poke $E000,127
  pacmandelay(1000)
  next

loop



'static ADDRESS_MAP_START( blueprnt_map, AS_PROGRAM, 8, blueprnt_state )
'AM_RANGE(0x0000, 0x7fff) AM_ROM // service mode checks for 8 chips = 64K
'AM_RANGE(0x8000, 0x87ff) AM_RAM
'AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(blueprnt_videoram_w) AM_MIRROR(0x400) AM_SHARE("videoram")
'AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_SHARE("scrollram")
'AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_SHARE("spriteram")
'AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1") AM_WRITE(blueprnt_coin_counter_w)
'AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2")
'AM_RANGE(0xc003, 0xc003) AM_READ(blueprnt_sh_dipsw_r)
'AM_RANGE(0xd000, 0xd000) AM_WRITE(blueprnt_sound_command_w)
'AM_RANGE(0xe000, 0xe000) AM_READ(watchdog_reset_r) AM_WRITE(blueprnt_flipscreen_w)
'AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(blueprnt_colorram_w) AM_MIRROR(0x400) AM_SHARE("colorram")
'ADDRESS_MAP_END




do

for eee=$9000 to $B0FF
  seed=smsrnd(seed)
  poke eee,seed
  poke $E000,127
  next
for eee=$F000 to $F3FF
  seed=smsrnd(seed)
  poke eee,seed
  poke $E000,127
  next

loop




attr01:
asm
  defb $0A,$0C,$0E,$11,$14,$15,$1C,$1D,$1E
  defb $21,$22,$23,$2A,$2B,$2E,$31,$33,$35
  defb $4A,$4C,$4E,$51,$54,$55,$5C,$5D,$5E
  defb $61,$62,$63,$6A,$6B,$6E,$71,$73,$75

  end asm


